<template>
  <div class="page-container">
    <el-select v-model="curComponent" clearable style="width: 300px;" @change="selectChange">
      <el-option
        v-for="item in selectOption"
        :key="item.value"
        :label="item.label"
        :value="item.value">
      </el-option>
    </el-select>
    <div v-loading="loading" class="container-box">
      <component :is="curComponent"></component>
    </div>
  </div>
</template>

<script>
import Triangle from '@/views/samples/cssExample/effect/components/Triangle.vue';
import Ripple from '@/views/samples/cssExample/effect/components/Ripple.vue';
import Surround from '@/views/samples/cssExample/effect/components/Surround.vue';
import ElementCarousel from '@/views/samples/cssExample/effect/components/ElementCarousel.vue';

export default {
  name: 'Effect', // 效果
  components: {
    Triangle,
    Ripple,
    Surround,
    ElementCarousel,
  },
  data() {
    return {
      loading: false,
      selectOption: [
        { label: '三角形', value: 'Triangle' },
        { label: '小圆点涟漪效果', value: 'Ripple' },
        { label: '星球环绕效果', value: 'Surround' },
        { label: '元素左右轮播', value: 'ElementCarousel' },
      ],
      curComponent: 'Triangle'
    };
  },
  methods: {
    selectChange() {
      this.loading = true;
      setTimeout(() => { this.loading = false; }, 500);
    }
  }
};
</script>

<style scoped lang="scss">
.container-box {
  margin-top: 10px;
}
</style>
